feat(ohos): window ops bridge + status readback + test scaffolding - #73
feat(ohos): window ops bridge + status readback + test scaffolding#73ddxwzc-boop wants to merge 8 commits into
Conversation
- lib.rs: create_borderless_window had two stacked #[cfg(desktop)] attributes (merge residual, harmless but redundant); collapsed to one. - review-checklist.md: add G10 (OHOS no-op/degraded impls need observability), distilled from review finding F6 (drag_window main-window Ok(()) with no log).
- tauri-runtime-wry: drain windowStatusChange queue, route by real OHOS windowId to tao apply_window_status (visible/fullscreen mirror backfill) - templates: declare ohos.permission.WINDOW_TOPMOST (desktop+mobile) - examples/api: new commands create_decorated_window / set_ime_position_test / create_transparent_ui_ability_window; build.rs + capabilities registered - TestRunner.svelte: Float sub-window manual test buttons (title/decoration flags/bg color/ime position), window-event watch; setOuterPosition demoted to smoke (moveWindowTo readback unreliable, per tauri-apps#143) - docs: OHOS window legacy-issues / test-mapping / test-buttons + skill notes
Package Changes Through 98a2f3fThere are 11 changes which include tauri with minor, @tauri-apps/api with minor, tauri-build with minor, tauri-macos-sign with patch, tauri-bundler with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-plugin with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
ddxwzc-boop
left a comment
There was a problem hiding this comment.
OHOS Code Review — tauri#73
| 🔴 | 🟡 | 🔵 | ℹ️ |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
Cross-repo group: window-ops bridge + status readback. The runtime-wry drain routing for windowStatusChange is correct and mirrors the proven drain_pending_window_closes bypass (real OHOS windowId, no reliance on tao's ZST WindowId). One cross-cutting note below. Inline comment attached.
Summary
- 🔵 The drain matches
w.window_id() == Some(ohos_win_id as i64). For a Float window whose creation failed (create_os_window(...).ok()→window_id: Nonein tao),window_id()returnsNonewhileohos_win_id()returns 0 — such a window never matches any drained status, so itsvisible/fullscreenmirror stays stale and itsset_*ops silently route to the main window (id=0). Cross-references tao G6 (create_os_windowfailure shouldreturn Err, not construct aNone-idWindow). - ℹ️ New comments/docs are in Chinese (H7) — 274 added lines, but the bulk is the two
doc/*.mdfiles which are intentionally Chinese; code-comment portion is small. Note checklist-vs-idiom tension.
Positive
build.rsregistersset_ime_position_test,create_decorated_window, andcreate_transparent_ui_ability_windowin the commands list — this fixes the known build.rs missing-registration panic (where unregistered transparent-ui-ability/ime commands caused codegen→runtime panic). Good catch.
Verify tao#20 set_min/max_inner_size 'four-value dispatch' fix: setMinSize(1600×1200 px) + setMaxSize(2400×1800 px) on main window. Before tao fix, setMaxSize would reset min to 0×0; after, both constraints persist. hilog WindowManager tag shows setWindowLimits four values both correct. Uses PhysicalSize to avoid LogicalSize scale(≈2.0) exceeding screen and triggering appfreeze.
PR#73 review (crates/tauri-runtime-wry/src/lib.rs:4514): the windowStatusChange drain's no-match branch was debug-only. Per the review, surface it at warn when a real (non-zero) OHOS window id was queued but matched no live window — that is a stale id (window destroyed between queue and drain) or a routing mismatch, worth investigating. Keep id=0 (main window / failed-Float sentinel) at debug to avoid noise. A failed Float window (window_id=None, ohos_win_id()==0) never queues a status (no real OHOS window), so it produces no drain event; the warn's presence thus distinguishes 'stale id' from the silent 'failed Float window' case. The tao-side G6 fix (create_os_window failure should return Err, not a None-id Window) is filed against tao#20 and out of scope here.
…manual test, docs & openspec Declare ohos.permission.LOCK_WINDOW_CURSOR in both ohos entry templates (normal/system_grant, since API 22). Upgrade the TestRunner setCursorGrab button from a no-throw smoke check to a real 5s lock/unlock test with focus-loss auto-release guidance. Correct the window docs: the old 'platform limitation' verdict came from grepping only ArkTS .d.ts — the LockCursor C API is NDK-only. Archive openspec p1/p2-cursor-grab design docs. Review checklist: +C6 (verify NAPI i64 marshalling claims against napi-ohos source, not stale repo comments); constraints doc: napi Result<T,S> alias trap.
Cursor grab enablement appended (bc4cec3)Completes the cursor-grab feature on top of tao#20 + openharmony-ability#45:
Device-verified end-to-end on MateBook Pro (HarmonyOS 6.1.0.117): all three behaviors pass, hilog zero errors, idempotent-unlock fix re-verified. |
On OHOS, a webview without explicit bounds must stay bounds-less so wry marks it natural-layout in WebViewStyle (no width/height -> ArkTS "100%") and it follows window resizes. The full-window fallback bounds made it explicit-size, desyncing its page layout on resize (BuilderNode.update does not notify ArkWeb to relayout).
068cdbe to
f179069
Compare
…ions - examples/api: get_ime_position_result command (registered in generate_handler, build.rs command list and capabilities/run-app.json) — poll pattern: ArkTS updateCursor's promise settles async after the sync NAPI call returns, so callers wait ~500ms after set_ime_position before polling. Set IME Position manual test rewritten to auto-focus an injected HTML input, invoke updateCursor, then render the real result from the readback command in manualResult. - docs: capability verdict corrections (IME 位置「平台限制」双重误判 纠偏 — updateCursor API10+ exists and works with a focused edit box, including HTML inputs in ArkWeb; window ops table/bullets refreshed).
另含 fix(review): 移除重复 #[cfg(desktop)] + 新增 G10 checklist (G10)